package top.csjss.hospital.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.csjss.hospital.entity.RegisteredType;
import top.csjss.hospital.mapper.RegisteredTypeMapper;
import top.csjss.hospital.service.RegisteredTypeService;
import top.csjss.hospital.vo.RegisteredTypeVO;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author ztf
 * @Date 19:31 2021/10/20
 **/
@Service
public class RegisteredTypeServiceImpl implements RegisteredTypeService {
    @Autowired
    private RegisteredTypeMapper registeredTypeMapper;

    @Override
    public List<RegisteredTypeVO> selectRegisteredType() {
        List<RegisteredType> registeredTypes = registeredTypeMapper.selectByExample(null);
        List<RegisteredTypeVO> data=new ArrayList<>();
        for (RegisteredType registeredType : registeredTypes) {
            RegisteredTypeVO vo = new RegisteredTypeVO(registeredType.getId(), registeredType.getType());
            data.add(vo);
        }
        return data;
    }

    @Override
    public Integer findPriceByRegisteredId(Integer registeredId) {
        // 查询&返回
        return registeredTypeMapper.findPriceByRegisteredId(registeredId);
    }
}
